//575. 分糖果

#include <stdio.h>
#include <stdlib.h>

int cmp_int(const void* p1, const void* p2)
{
    return *(int*)p1 - *(int*)p2;
}
int distributeCandies(int* candyType, int candyTypeSize){
    qsort(candyType, candyTypeSize, sizeof(int), cmp_int);
    int count = 1;
    for(int i = 1; i < candyTypeSize; i++)
    {
        if(candyType[i] != candyType[i-1])
        {
            count++;
        }
    }
    return count < candyTypeSize/2 ? count : candyTypeSize/2;
}

int main()
{
    int arr[] = {1,1,2,2,3,3};
    printf("%d\n", distributeCandies(&arr, sizeof(arr)/sizeof(int)));
    return 0;
}